﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LuKou.Shopspace.Domains;
using LuKou.Web.BLL.Service;

namespace LuKou.Web.BLL.Extensions
{
    public static class GoodsOrdersExt
    {
        public static IList<GoodsOrdersItem> GetGoodsOrdersItem(this GoodsOrders model)
        {
            return GoodsOrdersService.GetGoodsOrdersItemList(model.Code);
        }

        public static Goods GetGood(this GoodsOrdersItem model)
        {
            return GoodsService.GetGoodsDetail(model.GoodsID) ?? new Goods();
        }

        public static string GetGoodsSKUProp(this GoodsSKUProp model)
        {
            return string.Format("{0}-{1}",
                (CategoryService.GetCategoryPropDetail(model.Pid) ?? new CategoryProp()).Name,
                (CategoryService.GetCategoryPropValueDetail(model.Vid) ?? new CategoryPropValue()).Name);
        }
    }
}
